'use strict';


import React, {Component} from 'react';

import {
    View,
    Image,
    ImageBackground,
    Dimensions,
    TouchableWithoutFeedback,
    StyleSheet,
    Text,
    TouchableOpacity,
    TextInput,
    ScrollView,
    TouchableHighlight,
    TouchableNativeFeedback,
    Switch,
} from 'react-native';

import ToastUtil from '../../../../core/utils/toast-util';
import {Loading, EasyLoading} from 'react-native-easy-loading';
import DatePicker from 'react-native-datepicker'
import CameraButton from '../../../../core/component/comp.button-camera';
import Color from '../../../../core/constant/color';
import Http from '../../../../core/utils/http';

import MessageSayItem from '../../../../core/component-biz/comp.message-say-item';
import MessageInputPanel from '../../../../core/component-biz/comp.message-input-panel';

let winWidth = Dimensions.get('window').width;//屏幕宽度
let winHeight = Dimensions.get('window').height;//屏幕高度

class MessageScene extends React.Component {

    static navigationOptions = ({navigation, screenProps}) => {
        // console.log(navigation.state,"---->navigation.state")
        return {
            title: navigation.state.params.title,
            tabBarVisible: false,
            headerTintColor: "white",
            headerStyle: {
                backgroundColor: Color.PRIMARY_COLOR,
                elevation: null
            },
        }
    }

    constructor(props) {
        super(props);
        this.state = {}
    }

    componentDidMount() {
    }

    onPressMessageItem(item, index) {
        const {navigate} = this.props.navigation;
    }

    genMessageListUI() {
        const messageList = [
            {
                headUrl: require('../../../../img/icon_head_01.jpg'),
                nickName: '浪的宣言',
                gender: 'female',
                job: 'normal',
                city: '无锡市',
                message: 'Hi,大家好~~~',
                createTime: '19:49',
            },
            {
                headUrl: require('../../../../img/icon_head_04.jpg'),
                nickName: '浪的宣言',
                gender: 'male',
                job: 'normal',
                city: '北京市',
                message: '欢迎新人加入🙃',
                createTime: '19:49',
            },
            {
                headUrl: require('../../../../img/icon_head_02.jpg'),
                nickName: '浪的宣言',
                gender: 'female',
                job: 'normal',
                city: '南京市',
                message: '🙂大家都在讨论啥呢',
                createTime: '19:49',
            },
            {
                headUrl: require('../../../../img/icon_head_03.jpg'),
                nickName: '浪的宣言',
                gender: 'female',
                job: 'normal',
                city: '广州',
                message: '我也是服了~~~',
                createTime: '19:49',
            },
            {
                headUrl: require('../../../../img/icon_head_06.jpg'),
                nickName: '浪的宣言',
                gender: 'male',
                job: 'normal',
                city: '无锡市',
                message: '好无聊的🌺话题啊',
                createTime: '19:49',
            },
            {
                headUrl: require('../../../../img/icon_head_05.jpg'),
                nickName: '浪的宣言',
                gender: 'male',
                job: 'normal',
                city: '无锡市',
                message: '来来来，给大家讲个笑话，从前有座山，山上有个庙，庙里有个老和尚，老和尚对小和尚说，从前有座。。。',
                createTime: '19:49',
            }, {
                headUrl: require('../../../../img/icon_head_01.jpg'),
                nickName: '浪的宣言',
                gender: 'female',
                job: 'normal',
                city: '无锡市',
                message: '( ⊙ o ⊙ )啊！，这是要😖疯了。。。',
                createTime: '19:49',
            },
        ];
        const messageUI = messageList.map((item, index) => {
            return (<MessageSayItem key={`message-list-item-${index}`}
                                    headUrl={item.headUrl}
                                    nickName={item.nickName}
                                    gender={item.gender}
                                    job={item.job}
                                    city={item.city}
                                    message={item.message}
                                    createTime={item.createTime}
                                    onPress={this.onPressMessageItem.bind(this, item, index)}/>)
        })
        return messageUI
    }

    render() {
        return (
            <View style={styles.container}>
                <ScrollView style={styles.body}>
                    {this.genMessageListUI()}
                </ScrollView>
                <MessageInputPanel/>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    container:{
        flex: 1,
        backgroundColor: '#EBEBEB',
    },
    body: {
        backgroundColor: '#EBEBEB',
        flex: 1,
    },
});

export default MessageScene;